package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"net/http"
	"time"
)

const url = "https://apis-stage.ankr.com/117206ec6b3b4ce986d7205a0f05bf6a/e77362d2e70e93b2d1df2b1b8b246789/eth/fast/main"

func main() {
	var num int
	for {
		num++
		time.Sleep(time.Second)
		fmt.Printf("------------start %d------\n", num)
		for i := 0; i < 10; i++ {
			go post()
		}

		time.Sleep(time.Second * 5)
	}
}

var msg = `{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}`

func post() {
	resp, err := http.Post(url, "application/json", bytes.NewBuffer([]byte(msg)))
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(resp.StatusCode)
	bytesData, _ := ioutil.ReadAll(resp.Body)
	fmt.Println(string(bytesData))
}
